<?php
include 'topo.php';

if(isset($_GET["id"])==false)
{
    header("vacina.php");
}
$id = $_GET["id"];
$sql = "SELECT * FROM vacina where id=$id";
$resultado = pg_query($sql);
$linha = pg_fetch_assoc($resultado);


?>
        
        <div style="text-align:center;font-family: arial">


            <form action="vacina-alterar-ok.php" method="post"> 

                  <input type="hidden" name="id" value="<?php echo $linha['id'];?>" />

                <table border="0" cellpadding="0" cellspacing="0" width="25%">
                    <tr> 
                        <td width="30%">Nome:</td>
                        <td width="70%"><input type="text" name="nome" value="<?php echo $linha['nome'];?>"
                            required/></td>
                    </tr> 
                    <tr> 
                        <td width="30%">Obrigatoriedade:</td>
                        <td width="70%"><input type="checkbox" name="obrigatoria" <?php if($linha['obrigatoria']==1)echo "checked"; ?> /></td>
                    </tr> 
                    <tr> 
                        <td width="30%">Periodicidade:</td>
                        <td width="70%">

                            <select name="periodo">
                                <option value="">Selecionar</option>
                                <option value="m" <?php if($linha['periodicidade']=="m") echo "SELECTED";  ?>  >Mensal</option>
                                <option value="s" <?php if($linha['periodicidade']=="s") echo "SELECTED";  ?>   >Semestral</option>
                                <option value="a" <?php if($linha['periodicidade']=="a") echo "SELECTED";  ?>  >Anual</option> 
                                <option value="u" <?php if($linha['periodicidade']=="u") echo "SELECTED";  ?>  >Dosagem Única</option>   
                            </select>
                        </td>
                    </tr>
                   
                    <tr>
                        <td align="right" colspan='2'> 
                            <input type="submit" name="bot_enviar" value="ALTERAR"/> 
                        </td> 
                    </tr> 
                </table> 
            </form>	


        </div>
    </body>
</html>

